package pile.customer.controller;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.*;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.multipart.MultipartFile;
import pile.customer.entity.ResponseResult;
import pile.customer.service.IUserService;
import org.springframework.beans.factory.annotation.Autowired;
import pile.customer.entity.User;

import pile.customer.params.user.DeleDTO;
import pile.customer.params.user.ListDTO;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author 郭天义
 * @since 2024-06-01
 */
@RestController
@RequestMapping("/user")
public class UserController {

   @Autowired
   private IUserService userService;


    /**
    *  列表
    * @param listDTO
    * @return
    */
    @PostMapping("/list")
    public ResponseResult listPage(@Validated @RequestBody ListDTO listDTO){
    return  userService.listPage(listDTO);
    }



    /**
     *  查询未接入用户
     * @param listDTO
     * @return
     */
    @PostMapping("/userNotConnected")
    public ResponseResult userNotConnected(@Validated @RequestBody ListDTO listDTO){
        return  userService.userNotConnected(listDTO);
    }


    /**
     *  点击接入
     * @param listDTO
     * @return
     */
    @PostMapping("/clickToConnect")
    public ResponseResult clickToConnect(@Validated @RequestBody ListDTO listDTO){
        return  userService.clickToConnect(listDTO);
    }


    /**
     *  结束会话
     * @param listDTO
     * @return
     */
    @PostMapping("/endSession")
    public ResponseResult endSession(@Validated @RequestBody ListDTO listDTO){
        return  userService.endSession(listDTO);
    }

    /**
     * 文件 新增 上传文件
     * @param file
     * @return
     */
    @PostMapping("/addFile")
    public ResponseResult addFile(@RequestParam("file") MultipartFile file) {
        return userService.addFile(file);
    }




    /**
     * 是否已读
     * @param
     * @return
     */
    @PostMapping("/isRead")
    public ResponseResult isRead(@Validated @RequestBody ListDTO listDTO) {
        return userService.isRead(listDTO);
    }

}
